/*
    SUSAN® - Sole of Unix Save ANything

   Copyright (C) 2014-2014 Skyatlas Co. CN
   Copyright (C) 2014-2019 Hechzh Property

   

   

   
*/
/*
 * CEPHFS API device abstraction.
 *
 * Marco van Wieringen, May 2014
 */

#ifndef BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_
#define BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_

#include <cephfs/libcephfs.h>

namespace storagedaemon {

class cephfs_device : public Device {
 private:
  char* cephfs_configstring_;
  char* cephfs_conffile_;
  char* basedir_;
  struct ceph_mount_info* cmount_;
  POOLMEM* virtual_filename_;

 public:
  cephfs_device();
  ~cephfs_device();

  /*
   * Interface from Device
   */
  int d_close(int) override;
  int d_open(const char* pathname, int flags, int mode) override;
  int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
  boffset_t d_lseek(DeviceControlRecord* dcr,
                    boffset_t offset,
                    int whence) override;
  ssize_t d_read(int fd, void* buffer, size_t count) override;
  ssize_t d_write(int fd, const void* buffer, size_t count) override;
  bool d_truncate(DeviceControlRecord* dcr) override;
};

} /* namespace storagedaemon */

#endif /* BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_ */
